/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;

import java.sql.*;
import java.util.Vector;
import javax.swing.text.StyledEditorKit.BoldAction;

/**
 *
 * @author RUOL
 */
public class Tinhtranghocphi {
    private String Matinhtrang;
    private String Madk;
    private java.util.Date Ngaydong;
    private float Phidong;
    private float Thucdong;
    private String Lydodong;

    public Tinhtranghocphi() {
    }

    public Tinhtranghocphi(String Matinhtrang, Date Ngaydong, float Phidong, float Thucdong, String Lydodong) {
        this.Matinhtrang=Matinhtrang;
        this.Ngaydong = Ngaydong;
        this.Phidong = Phidong;
        this.Thucdong = Thucdong;
        this.Lydodong = Lydodong;
        
    }
 public String getMatinhtrang() {
        return Matinhtrang;
    }

    /**
     * @param Matinhtrang the Matinhtrang to set
     */
    public void setMatinhtrang(String Matinhtrang) {
        this.Matinhtrang = Matinhtrang;
    }

    /**
     * @return the Madk
     */
    public String getMadk() {
        return Madk;
    }

    /**
     * @param Madk the Madk to set
     */
    public void setMadk(String Madk) {
        this.Madk = Madk;
    }
    /**
     * @return the Ngaydong
     */

  
    public java.util.Date getNgaydong() {
        return Ngaydong;
    }

    /**
     * @param Ngaydong the Ngaydong to set
     */
    public void setNgaydong(java.util.Date Ngaydong) {
        this.Ngaydong = Ngaydong;
    }

    /**
     * @return the Phidong
     */
    public float getPhidong() {
        return Phidong;
    }

    /**
     * @param Phidong the Phidong to set
     */
    public void setPhidong(float Phidong) {
        this.Phidong = Phidong;
    }

    /**
     * @return the Thucdong
     */
    public float getThucdong() {
        return Thucdong;
    }

    /**
     * @param Thucdong the Thucdong to set
     */
    public void setThucdong(float Thucdong) {
        this.Thucdong = Thucdong;
    }

    /**
     * @return the Lydodong
     */
    public String getLydodong() {
        return Lydodong;
    }

    /**
     * @param Lydodong the Lydodong to set
     */
    public void setLydodong(String Lydodong) {
        this.Lydodong = Lydodong;
    }
    
    public Tinhtranghocphi ThongTin_TTHP()
            
    {
        Tinhtranghocphi dm = new Tinhtranghocphi();
        
        try
        {
            Connection con = ConnectToDatabase.getConnection();
             //select * from Sinhvien, Khoa_sinhvien,Tinhtranghocphi where Sinhvien.Masv='sv1'
            String query = "select * from Tinhtranghocphi where Matinhtrang = '"+this.Matinhtrang+"'";
            Statement st = con.createStatement();
            ResultSet rs = st.executeQuery(query);
            while(rs.next())
            {
                dm.setNgaydong(rs.getDate("Ngaydong"));
                dm.setPhidong(rs.getFloat("Phidong"));
                dm.setThucdong(rs.getFloat("Thucdong"));
                dm.setLydodong(rs.getString("Lydodong"));

            }
        }
        catch(Exception ex)
        {
            dm = null;
        }
        
        return dm;
    }
    public Vector<Vector> TTDP()
    {
        Vector<Vector> dsdm = new Vector<Vector>();
        
        try
        {
            Connection con = ConnectToDatabase.getConnection();
            String query = "select * from Tinhtranghocphi where Madk='"+this.Madk+"'";
            Statement st=con.createStatement();
            ResultSet rs = st.executeQuery(query);
            while(rs.next())
            {
                Vector<Object> dm = new Vector<Object>();
                dm.add(rs.getString("Matinhtrang"));
                dm.add(rs.getString("Madk"));
                dm.add(rs.getDate("Ngaydong"));
                dm.add(rs.getFloat("Phidong"));
                dm.add(rs.getFloat("Thucdong"));
                dsdm.add(dm);
            }
        }
        catch(Exception ex)
        {
            dsdm = null;
        }
        
        return dsdm;
    }


}
